package com.citycloud.ccuap.tc.admin.admininterface;

import com.citycloud.ccuap.framework.service.mybatis.MybatisServiceImpl;
import com.citycloud.ccuap.tc.admin.entity.SysAdminInterface;
import com.citycloud.ccuap.tc.admin.repository.SysAdminInterfaceRepository;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 应用功能业务处理实现
 * @author zhusr
 *
 */
@Service
public class AdminInterfaceService extends MybatisServiceImpl<SysAdminInterfaceRepository, SysAdminInterface, Long> implements IAdminInterfaceService {

    @Override
    public List<SysAdminInterface> getClientInterfaces(String resourceIds){
        String sql = "SELECT inrerface.* FROM sys_client_resource_interface_rel rel INNER JOIN sys_admin_interface inrerface ON rel.interface_id = inrerface.interface_id WHERE 1=1 ";
        if (StringUtils.isNotBlank(resourceIds)) {
            sql += " AND FIND_IN_SET (rel.resource_id, '";
            sql += resourceIds;
            sql += "' )";
        }
        return (List<SysAdminInterface>) super.selectList(SysAdminInterface.class, sql, true);
    }
}